<?php

class Order_model extends CI_Model {
    
    private $_table = "aw_orders";

    function __construct() {
        parent::__construct();
    }
    
    function save($data, $dataCart) {
        if ($this->db->insert($this->_table, $data)) {
            $newsID = $this->db->insert_id();
            foreach($dataCart as $item) {
                $item['order_id'] = $newsID;
                $this->db->insert("aw_order_product", $item);
            }
            return $newsID;
        } else {
            return false;
        }
    }
	 function getOrderFromId($order_id) {
		$this->db->where('order_id',$order_id);
        return $result = $this->db->get('order_product')->result();
    }
	

}

?>
